package custom.cards;

import java.io.Serializable;

public class GameRequest implements Serializable
{

	private static final long serialVersionUID = 1L;

	public String GameID;
	public String GameName;
	public RequestType requestID;
	public String requestingPlayerID;
	public String fromPlayerID;
	public String toPlayerID;
	public String cardNumberString;
	public String Message;
	public String playerName;
	public boolean booleanCondition;
	public boolean isShown;
	
	
	/**
	 * For registering your device with the game server
	 * 
	 * @param regID  regID the android Registration ID set by the google API (playerID)
	 */
	public GameRequest(String regID)
	{
		this.requestingPlayerID = regID;
		this.requestID = RequestType.RegID;

	}
	
	
	/**
	 * General request for some type of game request
	 * 
	 * @param GameID String ID of the game you want to perform an operation on
	 * @param regID the android Registration ID set by the google API (playerID)
	 * @param req the request type of the request (See enum below)
	 */
	public GameRequest(String GameID, String regID, RequestType req)
	{
		this.GameID = GameID;
		this.requestingPlayerID = regID;
		this.requestID = req;
	}
	
	/**
	 * For sending messages to all players in the game
	 * 
	 * @param GameID String ID of the game you want to perform an operation on
	 * @param regID  regID the android Registration ID set by the google API (playerID)
	 * @param Message message to send
	 */
	public GameRequest(String GameID, String regID,String Message)
	{
		this.GameID = GameID;
		this.requestingPlayerID = regID;
		this.requestID = RequestType.SendMessage;
		this.fromPlayerID = regID;
		this.Message = Message;
	}
	
	
	
	/**
	 * Request to see another players cards
	 * 
	 * @param GameID String ID of the game you want to perform an operation on
	 * @param regID the android Registration ID set by the google API (playerID)
	 * @param req recommended to be RequestType.GetCards
	 * @param playersCardsToSee playerID of who's cards you want to see
	 */
	public GameRequest(String GameID, String regID, RequestType req,String playersCardsToSee)
	{
		this.GameID = GameID;
		this.requestingPlayerID = regID;
		this.requestID = req;
		this.toPlayerID = playersCardsToSee;
	}

	
	 
	
	 
	/**
	 * For sending messages to a specific player in the game
	 * 
	 * @param GameID String ID of the game you want to perform an operation on
	 * @param regID  regID the android Registration ID set by the google API (playerID)
	 * @param toPlayerID regID the android Registration ID to send the message to
	 * @param Message message to send
	 */
	public GameRequest(String GameID, String regID,String toPlayerID,String Message)
	{
		this.GameID = GameID;
		this.requestingPlayerID = regID;
		this.requestID = RequestType.SendMessage;
		this.toPlayerID = toPlayerID;
		this.fromPlayerID = regID;
		this.Message = Message;
	}
	

	 
	/**
	 * For mapping the playersID with their DisplayName when joining a game
	 * 
	 * @param GameID String ID of the game you want to perform an operation on
	 * @param regID  regID the android Registration ID set by the google API (playerID)
	 * @param Name DisplayName of the requesting regID
	 * @param req RequestType.JoinGame is suggested
	 */
	public GameRequest(String GameID, String regID, String Name, RequestType req)
	{
		this.requestingPlayerID = regID;
		this.requestID = req;
		this.GameID = GameID;
		this.playerName = Name;
		

	}
	

	
	/**
	 * For mapping the playersID with their DisplayName when creating a game
	 * 
	 * @param GameID String ID of the game you want to perform an operation on
	 * @param regID  regID the android Registration ID set by the google API (playerID)
	 * @param Name DisplayName of the requesting regID
	 * @param GameName the name of the game to display
	 * @param req RequestType.CreateGame is suggested
	 */
	public GameRequest(String GameID, String regID, String Name, String GameName,RequestType req)
	{
		this.requestingPlayerID = regID;
		this.requestID = req;
		this.GameID = GameID;
		this.playerName = Name;
		this.GameName = GameName;
		

	}

	 
	/**
	 * For passing a card from one player to another or to the deck
	 * 
	 * @param GameID String ID of the game you want to perform an operation on
	 * @param regID  regID the android Registration ID set by the google API (playerID)
	 * @param fromPlayerID regID the android Registration ID for the player that is passing the card (DECK or null accepted)
	 * @param toPlayerID regID the android Registration ID for the player that the card is going to (DECK accepted)
	 * @param c Card object to pass from one place to another 
	 * @param req the request type of the request (See enum below)
	 * @param allCards true if you want to pass all cards from one player to the other 
	 */
	public GameRequest(String GameID, String regID, String fromPlayerID, String toPlayerID ,Card c, RequestType req, boolean allCards)
	{
		this.GameID = GameID;
		this.requestingPlayerID = regID;
		this.requestID = req;
		this.cardNumberString = c.toNumberString();
		this.fromPlayerID = fromPlayerID;
		this.toPlayerID = toPlayerID;
		this.booleanCondition = allCards;

	}
	



	public enum RequestType
	{
		RegID, 
		CreateGame, 
		JoinGame,
		PassCard,
		SendMessage,
		EndGame,
		StartGame,
		LeaveGame,
		GetCards,
		LockCards


	}

}
